const electronAPI = window.electronAPI;

// 原生titlebar
export function setTitle(data) {
  electronAPI.sendIpcMessage({
    type: "setTitle",
    data,
  });
}

export function creatOCRDataset(data) {
  electronAPI.postPortMessage({
    type: "creatOCRDataset",
    data,
  });
}

export async function getDir(path = '') {
  return electronAPI.invokeIpc('getDir', path)
}

export async function getFile(path) {
  return electronAPI.invokeIpc('getFile', path)
}

export async function createFile(path, data) {
  return electronAPI.invokeIpc('createFile', path, data)
}

export async function deleteFile(path) {
  return electronAPI.invokeIpc('deleteFile', path)
}

export function dialogOpenFile() {
  electronAPI.invokeIpc("dialog:openFile");
}
